<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <form class="form-inline" action="" method="get">
                                <a class="btn btn-info" href="{:U('add')}" value="">新增</a>
                                <label class="inline">用户搜索</label>
                                <select name="field" class="form-control">
                                    <option <if condition="I('field') eq user">selected</if> value="user">用户名</option>
                                    <option <if condition="I('field') eq phone">selected</if> value="phone">电话</option>
                                    <option <if condition="I('field') eq qq">selected</if> value="qq">QQ</option>
                                    <option <if condition="I('field') eq email">selected</if> value="email">邮箱</option>
                                </select>
                                <input type="text" name="keyword" value="{:I(keyword)}" class="form-control">
                                <label class="inline">&nbsp;&nbsp;排序：</label>
                                <select name="order" class="form-control">
                                    <option <if condition="I('order') eq asc">selected</if> value="asc">注册时间升</option>
                                    <option <if condition="I('order') eq desc">selected</if> value="desc">注册时间降</option>
                                </select>
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </button>
                            </form>
                        </div>
                        <div class="space-4"></div>
                        <div class="row">
							<style type="text/css">
								.head_pic{width:30px;height:30px; border-radius:50%}
							</style>

							<table class="table table-bordered tables">
								<thead>
								<tr>
									<th>用户ID</th>
									<th>头像</th>
									<th>用户名称</th>
									<th>书豆</th>
									<th>积分</th>
									<th>注册时间</th>
								</tr>
								</thead>
								<tbody>
								<volist name="data" id="vo">
								<tr>
									<td>{$vo.uid}</td>
									<td><img src="{$vo.head_portrait}" class='head_pic'/></td>
									<td>{$vo.username}</td>
									<td>{$vo.book_bean}</td>
									<td>{$vo.integral}</td>
									<td>{$vo.time|date='Y-m-d H:i:s' , ###}</td>
								</tr>
								</volist>
								</tbody>
							</table>
							{$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $(".group").click(function () {
            $(this).addClass('hide');
            $(this).parent().find(".groupselect").removeClass('hide');
        })
        $(".groupselect").on("change", function () {
            var ob = $(this);
            var gid = ob.val();
            var uid = ob.parent().find('.group').attr('val');
            $.get("{:U('update')}?ajax=yes&uid=" + uid + "&gid=" + gid, function (data) {
                var text = ob.find("option:selected").text();
                ob.parent().find(".group").removeClass('hide').html(text);
                ob.addClass('hide');
            });
        })

        $(".check-all").click(function () {
            $(".uids").prop("checked", this.checked);
        });
        $(".uids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除所选用户？",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该用户?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
		
		function set_enable(uid, value){

			$.post("{:U('enable')}" , {uid :uid , value : value} , function(data){

				if(data.status ==  1){

					layer.alert(data.msg , function(){

						window.location.reload();

					});
				}else{

					layer.alert(data.msg);

				}

			})

		}
    })
</script>
</body>
</html>